Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL/HIGH] Fix local code execution risk in Git invocations#70

Open
tachyon-beep wants to merge 2 commits into
mainfrom
fix/sentinel-git-lce-7919555956177251259
Open

πŸ›‘οΈ Sentinel: [CRITICAL/HIGH] Fix local code execution risk in Git invocations#70
tachyon-beep wants to merge 2 commits into
mainfrom
fix/sentinel-git-lce-7919555956177251259

Conversation

@tachyon-beep

Copy link
Copy Markdown
Collaborator

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: The application invokes git commands via subprocess.run without specifying -c core.fsmonitor=false in directories that may contain untrusted code. This allows local code execution via a malicious .git/config file overriding git settings or hooks.
🎯 Impact: An attacker could place a malicious .git/config inside a directory. When the victim scans that directory using Wardline, git commands like git rev-parse or git status would execute the attacker's script, resulting in full local code execution.
πŸ”§ Fix: Applied _SAFE_GIT_CONFIG = ("-c", "core.fsmonitor=false") to all git subprocess commands in src/wardline/core/delta.py and src/wardline/core/legis.py. Updated tests/unit/core/test_delta.py to match the exact subprocess.run arguments including -c core.fsmonitor=false.
βœ… Verification: Ensure the test suite passes with make test. Ensure that grep -rn "subprocess\.run(.*git" src/wardline/core/ no longer shows any git invocations without *_SAFE_GIT_CONFIG.


PR created automatically by Jules for task 7919555956177251259 started by @tachyon-beep

Adds `_SAFE_GIT_CONFIG = ("-c", "core.fsmonitor=false")` to `subprocess.run` calls
that invoke `git` in untrusted directories. This prevents arbitrary local code execution
if a directory being scanned contains a malicious `.git/config` file.

Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Fixes line too long ruff lint errors in `tests/unit/core/test_delta.py`
by formatting with `make format`.

Co-authored-by: tachyon-beep <544926+tachyon-beep@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d476c974e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/unit/core/test_delta.py Outdated
Comment on lines +46 to +47
assert mock_run.call_args_list[1].args[0] == ["git", "-c", "core.fsmonitor=false", "rev-parse", "--verify", "--end-of-options", "HEAD~1"]
assert mock_run.call_args_list[2].args[0] == ["git", "-c", "core.fsmonitor=false", "diff", "--name-only", "abc123", "--"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wrap the new argv assertions to keep lint passing

In this repo make lint runs ruff check src tests, and these updated expected-argv literals now exceed the configured 120-character line length: ruff check tests/unit/core/test_delta.py reports E501 on both lines. Any CI path using the lint target will fail before exercising the security fix, so split these lists across lines.

Useful? React with πŸ‘Β / πŸ‘Ž.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant